package com.hz.web.controller;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.annotation.Resource;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import com.hz.web.entity.Lzonghe640Entity;
import com.hz.web.service.Ilzonghe640Service;
/**
 * 行政许可公示
 * @author Administrator
 *
 */
@Controller
@RequestMapping("lzonghe640")
public class Lzonghe640Controller {

	@Resource
	private Ilzonghe640Service lzonghe640Service;
	
	
	
	/**
	 * 查询许可公示信息
	 * @return
	 */
	@RequestMapping("queryLzonghe640")
	@ResponseBody
	public Map<String, Object> queryLzonghe640(Integer page,Integer count,String code,
			String peopleValue,String nameValue,String dateStart,String dateEnd,
			String sysId
			){
		Map<String, Object> resultMap = new HashMap<String, Object>();
		Map<String, Object> parmsMap = new HashMap<String, Object>();//参数map
		if(sysId!=null && !"".equals(sysId.trim()) && !"no".equals(sysId.trim())){
			parmsMap.put("sysId",sysId.trim());
		}
		if(code!=null && !"".equals(code.trim()) && !"1".equals(code.trim())){
			parmsMap.put("code",code.trim());
		}
		if(peopleValue!=null && !"".equals(peopleValue.trim())){
			parmsMap.put("peopleValue","%"+peopleValue.trim()+"%");
		}
		if(nameValue!=null && !"".equals(nameValue.trim())){
			parmsMap.put("nameValue","%"+nameValue.trim()+"%");
		}
		if(dateStart!=null && !"".equals(dateStart.trim())){
			parmsMap.put("dateStart",dateStart.trim());
		}
		if(dateEnd!=null && !"".equals(dateEnd.trim())){
			parmsMap.put("dateEnd",dateEnd.trim()+" 23:59:59");
		}
		if(page!=null && count!=null){
			int index = (page-1)*count;
			int end = count;
			parmsMap.put("index",index);
			parmsMap.put("end",end);
		}
		
		List<Lzonghe640Entity> list640 = lzonghe640Service.query640(parmsMap);
		resultMap.put("list640", list640);//行政许可公示信息
		if( sysId==null ||  "".equals(sysId.trim())){
			int totalCount = lzonghe640Service.query640Count(parmsMap);
			resultMap.put("totalCount", totalCount);//行政许可公示信息总条数
		}
		return resultMap;
	}
	/**
	 * 查询许可信息的部门信息
	 * @return
	 */
	@RequestMapping("queryCode640")
	@ResponseBody
	public Map<String, Object> queryCode640(){
		Map<String, Object> resultMap = new HashMap<String, Object>();
		Map<String, Object> parmsMap = new HashMap<String, Object>();//参数map
		List<Lzonghe640Entity> code640 =new ArrayList<Lzonghe640Entity>();
		code640 = lzonghe640Service.queryCode(parmsMap);
		resultMap.put("code640", code640);//行政许可公示信息
		return resultMap;
	}
	
}
